package com.toppitch.site.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Handles requests for the application home page.
 */
@Controller
public class HomeController extends BaseController {
	/**
	 * Simply selects the home view to render by returning its name.
	 */
	@RequestMapping(value = "/to", method = RequestMethod.GET)
	public String to(
			@RequestParam(value = "pagename", defaultValue = "login") String pagename,
			ModelMap modelMap) {
		setupNYTNews(modelMap);
		return pagename;
	}

	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String home(ModelMap modelMap) {
		setupNYTNews(modelMap);
		return "login";
	}

}
